草庐IT

database - SQLite.NET 和 SQL Server Compact 的优缺点

全部标签

Ruby Guard 问题 - 'Please install the sqlite3 adapter' - railstutorial.org

我正在关注RubyonRailsTutorial并且在测试部分变得有些困惑,特别是-3.6.2-AutomatedtestswithGuard按照部署到Heroku的教程说明,我已切换到Postgresql并从我的gemfile中删除了sqlite3,并进行了捆绑安装以进行更新。但是,一旦我运行bundleexecguard我收到消息:/Users/username/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.3/lib/bundler/rubygems_integration.rb:147:inblockinreplace_ge

ruby-on-rails - 使用 cookie 制作 Ruby Net::HTTP::Get 请求

我想通过ruby​​打开我的stackoverflow.com页面。我希望看到它就像我通过了身份验证一样。我从GoogleChrome中获取了usrcookie并创建了以下代码段:require'net/http'require'cgi'url="http://stackoverflow.com/users/1650525/alex-smolov"uri=URI(url)http=Net::HTTP.new(uri.host,80)request=Net::HTTP::Get.new(uri.request_uri)cookie=CGI::Cookie.new("usr","[myco

ruby-on-rails - RoR Net::HTTP 发布错误未定义方法 `bytesize'

我目前正在反复用头撞墙,直到通过这个问题。我正在使用ruby​​-1.9.3-p194和Rails。我正在尝试发出一个post请求,我可以使用Net::HTTP.post_form完成它,但我不能在这里使用它,因为我需要在header中设置一个cookie。http.post是错误的说法"undefinedmethod`bytesize'for#"因为我猜它正在尝试对发送的数据执行一些操作。有没有人有某种修​​复或解决方法?谢谢headers={'Cookie'=>'mycookieinformationinhere'}uri=URI.parse("http://asite.com/w

ruby-on-rails - database.yml &references 不工作

我们刚刚将虚拟机升级到我认为相同的ruby​​配置(通过RVM...Ruby1.9.2、Rails3.0.7、DataMapper1.1.0)。最大的区别是我们从MySQL5.0升级到5.1。出于某种原因,在我们的旧VM上运行的完全相同的代码/database.yml现在在我们的新VM尝试连接到数据库时失败了。问题是这个YAML:mysql_defaults:&mysql_defaultsadapter:mysqlencoding:UTF-8username:userpassword:passhost:localhostdevelopment:正在扩展到:"mysql_defaults

ruby-on-rails - rails : modify form parameters before modifying the database

我正在开发一个通过表单发送数据的Rails应用程序。我想在表单发送之后,但在它被处理之前修改表单的一些“参数”。我现在拥有的{"commit"=>"Create","authenticity_token"=>"0000000000000000000000000""page"=>{"body"=>"TEST","link_attributes"=>[{"action"=>"Foo"},{"action"=>"Bar"},{"action"=>"Test"},{"action"=>"Blah"}]}}我想要什么{"commit"=>"Create","authenticity_token"

ruby - Capistrano - 无法部署我的 database.yml

当我尝试使用capistrano部署我的应用程序时,我会收到此错误:failed:"sh-c'cp/var/www/my_app/releases/20120313115055/config/database.staging.yml/var/www/my_app/releases/20120313115055/config/database.yml'"onIP_ADDR我的database.yml即空的,database.staging.yml:production:adapter:mysql2encoding:utf8reconnect:falsedatabase:my_dbpool

c# - 如何从 .NET 风格的 TDD 迁移到 Ruby?

我一直在努力将我用于测试驱动.NET代码的标准方法调整为Ruby。例如,我正在编写一个类,它将:graball*.markdownfilesfromadirectoryforeachfile:extractcodesamplesfromfilesavecodetofile.csinoutputdirectory通常对于.NET,我最终会得到类似这样的东西:classExamplesToCode{publicExamplesToCode(IFileFinderfinder,IExampleToCodeConverterconverter){...}publicvoidConvert(st

Ruby 1.8.7 和 Net::HTTP:使用客户端证书发出 SSL GET 请求?

我正在尝试使用Net::HTTP通过SSL获取资源。这是相关的代码片段:req=Net::HTTP::Get.new(ContentURI.path)https=Net::HTTP.new(ContentURI.host,ContentURI.port)https.use_ssl=truehttps.cert=OpenSSL::X509::Certificate.new(@cert_raw)https.key=OpenSSL::PKey::RSA.new(@cert_key_raw)https.verify_mode=OpenSSL::SSL::VERIFY_PEERhttps.ca_

ruby-on-rails - Ruby NET::HTTP 在主体之前读取 header (没有 HEAD 请求)?

我使用Net::HTTP和Ruby来抓取URL。我不想抓取流式音频,例如:http://listen2.openstream.co/334其实我只想抓取Html内容,所以没有pdfs、video、txt..现在,我将open_timeout和read_timeout都设置为10,所以即使我抓取这些流式音频页面,它们也会超时。url='http://listen2.openstream.co/334'path=uri.pathreq=Net::HTTP::Get.new(path,{'Accept'=>'*/*','Content-Type'=>'text/plain;charset=u

ruby - 如何在 ruby​​ 脚本中使用 Net::FTP 将远程 FTP 服务器上的文件移动到同一 FTP 服务器上的目录

如何在ruby​​脚本中使用Net::FTP将远程FTP服务器上的文件移动到同一FTP服务器上的目录。我知道文件名并且我使用ftp.mkdir创建了一个目录,但显然没有将文件移动到创建的文件夹的方法。 最佳答案 可以使用Net::FTP类的rename()方法移动文件(和目录)。示例:ftp=Net::FTP.new("ftp.myserver.com","myusername","mypassword")ftp.binary=trueftp.passive=truepath1="/original/dir/path/"#Dirto